package com.bawei.module_mine

import android.view.View
import com.alibaba.android.arouter.launcher.ARouter
import com.bawei.lib_common.Router
import com.bawei.lib_common.appContext
import com.bawei.lib_common.base.BaseFragment
import com.bawei.lib_common.base.BaseViewModel
import com.bawei.lib_common.utils.ToastUtils
import com.bawei.lib_storage.AppMMKV
import com.bawei.lib_storage.AuthMMKV
import com.bawei.module_mine.databinding.FragmentMineBinding


class MineFragment : BaseFragment<BaseViewModel,FragmentMineBinding>() {
    override val mLayoutResId: Int
        get() = R.layout.fragment_mine
    var token:String=""
    var name:String=""
    override fun initView() {
        super.initView()

        mBinding.tx.setOnClickListener {
            ARouter.getInstance().build(Router.LOGIN_PAGE).navigation()
        }
        mBinding.wdsq.setOnClickListener {
            ARouter.getInstance().build(Router.MY_APPLY_PAGE).navigation()
        }
        mBinding.wdsh.setOnClickListener {
            ARouter.getInstance().build(Router.MY_CHECK_PAGE).navigation()
        }
        token=AppMMKV.token
        mBinding.name.setOnClickListener {
            if (token.isEmpty()){
                ToastUtils.showLong(appContext,"lyj+lyt")
            }
            ToastUtils.showLong(appContext,token)
        }
        if(AuthMMKV.hasLogin()){
            mBinding.loginLl.visibility=View.VISIBLE
            mBinding.name.setText(AppMMKV.username)
        }else{
            mBinding.name.setText("未登录")
        }
    }

}